package com.changpay.zywy.ui.activity.mine
import android.content.Intent
import android.view.View
import com.changpay.zywy.R
import com.changpay.zywy.base.BaseActivity
import com.changpay.zywy.base.IView
import com.changpay.zywy.ext.showToast
import kotlinx.android.synthetic.main.activity_unbind_bank_card.*
import kotlinx.android.synthetic.main.title_layout.*


class UnBindBankCardActivity : BaseActivity(), IView {

    private var bank_id: String? = null


        private val onClickListener = View.OnClickListener { view ->
            when (view.id) {
                R.id.iv_back -> finish()
                R.id.tv_summit-> submit()
            }
        }

    private fun submit() {
        val intent = Intent(this, PayPasswordActivity::class.java)
        intent.putExtra("activity_title", "解绑银行卡")
        intent.putExtra("message", "输入支付密码，以验证身份")
        intent.putExtra("title", "解绑银行卡")
        intent.putExtra("imp_type", 0)
        intent.putExtra("card_id", bank_id)
        startActivity(intent)
    }

    override fun attachLayoutRes(): Int {
        return R.layout.activity_unbind_bank_card
    }

    override fun showLoading() {

    }

    override fun hideLoading() {

    }

    override fun showDefaultMsg(msg: String) {
        showToast(msg)
    }

    override fun showMsg(msg: String) {
        showToast(msg)
    }

    override fun showError(errorMsg: String) {
        showToast(errorMsg)
    }




    override fun initData() {

    }

    override fun initView() {
        tv_title.text = "解绑银行卡"
        val bank_name = intent.getStringExtra("bank_name")
        val bank_number = intent.getStringExtra("bank_number")
        bank_id = intent.getStringExtra("bank_id")
        tv_bank_name.text = bank_name
        val substring = bank_number.substring(bank_number.length - 4, bank_number.length)
        tv_card_id.text = "**** **** **** $substring"
        tv_summit.setOnClickListener(onClickListener)
        iv_back.setOnClickListener(onClickListener)
    }

    override fun start() {

    }
}
